﻿<UserControl x:Class="SoGame.Views.TopPlayersView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:me="clr-namespace:SoGame.ViewModels"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <me:TopPlayersViewModel x:Key="viewModel" />
    </UserControl.Resources>
    <Grid DataContext="{Binding Source={StaticResource viewModel}}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.35*"/>
            <ColumnDefinition Width="0.65*"/>
        </Grid.ColumnDefinitions>
        <Grid x:Name="Player1" DataContext="{Binding Player1}" Margin="0,-10,0,0" HorizontalAlignment="Center" VerticalAlignment="Top" Grid.Column="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid Grid.RowSpan="2" VerticalAlignment="Top" Margin="2">
                <Rectangle Fill="{DynamicResource HighlightBrush}" Stroke="{x:Null}" Width="50" Height="50"/>
                <TextBlock Text="1" Grid.RowSpan="1" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White" Style="{DynamicResource MetroHeader1}"/>
            </Grid>
            <StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Top" Grid.RowSpan="1">
                <TextBlock Text="{Binding Path=Player.Name}" Height="Auto" Margin="0,0,5,0" Style="{DynamicResource ItemTitle}"/>
                <TextBlock Text="{Binding Path=Player.FirstName}" Height="Auto" Style="{DynamicResource ItemTitle}"/>
            </StackPanel>
            <TextBlock Text="{Binding Path=Score, StringFormat='Score: {0}'}" Grid.ColumnSpan="1" Grid.Column="1" Grid.RowSpan="1" Grid.Row="1" Foreground="{DynamicResource HighlightBrush}" Style="{DynamicResource ItemTitle}"/>
        </Grid>
        <Grid x:Name="Player2" DataContext="{Binding Player2}" HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Column="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid Grid.RowSpan="2" VerticalAlignment="Top" Margin="2">
                <Rectangle Fill="{DynamicResource HighlightBrush}" Stroke="{x:Null}" Width="50" Height="50"/>
                <TextBlock Text="2" Grid.RowSpan="1" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White" Style="{DynamicResource MetroHeader1}"/>
            </Grid>
            <StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Top" Grid.RowSpan="1">
                <TextBlock Text="{Binding Path=Player.Name}" Height="Auto" Margin="0,0,5,0" Style="{DynamicResource ItemTitle}"/>
                <TextBlock Text="{Binding Path=Player.FirstName}" Height="Auto" Style="{DynamicResource ItemTitle}"/>
            </StackPanel>
            <TextBlock Text="{Binding Path=Score, StringFormat='Score: {0}'}" Grid.ColumnSpan="1" Grid.Column="1" Grid.RowSpan="1" Grid.Row="1" Foreground="{DynamicResource HighlightBrush}" Style="{DynamicResource ItemTitle}"/>
        </Grid>
        <Grid x:Name="Player3" DataContext="{Binding Player3}" HorizontalAlignment="Right" VerticalAlignment="Bottom" Grid.Column="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid Grid.RowSpan="2" VerticalAlignment="Top" Margin="2">
                <Rectangle Fill="{DynamicResource HighlightBrush}" Stroke="{x:Null}" Width="50" Height="50"/>
                <TextBlock Text="3" Grid.RowSpan="3" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White" Style="{DynamicResource MetroHeader1}"/>
            </Grid>
            <StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Top" Grid.RowSpan="1">
                <TextBlock Text="{Binding Path=Player.Name}" Height="Auto" Margin="0,0,5,0" Style="{DynamicResource ItemTitle}"/>
                <TextBlock Text="{Binding Path=Player.FirstName}" Height="Auto" Style="{DynamicResource ItemTitle}"/>
            </StackPanel>
            <TextBlock Text="{Binding Path=Score, StringFormat='Score: {0}'}" Grid.ColumnSpan="1" Grid.Column="1" Grid.RowSpan="1" Grid.Row="1" Foreground="{DynamicResource HighlightBrush}" Style="{DynamicResource ItemTitle}"/>
        </Grid>
        <ListBox ItemsSource="{Binding Top10Scores}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Grid Grid.RowSpan="2" VerticalAlignment="Top" Margin="2">
                            <Rectangle Fill="{DynamicResource HighlightBrush}" Stroke="{x:Null}" Width="50" Height="50"/>
                            <TextBlock Text="{Binding Path=Position}" Grid.RowSpan="1" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White" Style="{DynamicResource MetroHeader1}"/>
                        </Grid>
                        <StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Top" Grid.RowSpan="1">
                            <TextBlock Text="{Binding Path=GamePlay.Player.Name}" Height="Auto" Margin="0,0,5,0" Style="{DynamicResource ItemTitle}"/>
                            <TextBlock Text="{Binding Path=GamePlay.Player.FirstName}" Height="Auto" Style="{DynamicResource ItemTitle}"/>
                        </StackPanel>
                        <TextBlock Text="{Binding Path=GamePlay.Score, StringFormat='Meilleur score: {0}'}" Grid.ColumnSpan="1" Grid.Column="1" Grid.RowSpan="1" Grid.Row="1" Foreground="{DynamicResource HighlightBrush}" Style="{DynamicResource ItemTitle}"/>
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <Image Source="/SoGame;component/Assets/Images/podium.png" VerticalAlignment="Center" d:LayoutOverrides="GridBox" Grid.Column="1" HorizontalAlignment="Center" Margin="-50,0"/>
        <StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,-15,0,0">
            <Button Command="{Binding GameSelection}" CommandParameter="SOSLAM" Style="{DynamicResource MetroPathTitleButton}">
                <TextBlock Text="SOSLAM" Style="{DynamicResource MetroHeader2}" Margin="15,0,0,0" />
            </Button>

            <Button Command="{Binding GameSelection}" CommandParameter="SOTANK" Style="{DynamicResource MetroPathTitleButton}">
                <TextBlock Text="SOTANK" Style="{DynamicResource MetroHeader2}" Margin="15,0,0,0" />
            </Button>



            <!--<TextBlock TextWrapping="Wrap" d:LayoutOverrides="Width" Margin="15,0,0,0" Style="{DynamicResource MetroHeader2}" Foreground="Black" FontSize="18.667"><Run Language="fr-fr" Text="SOSLAM"/></TextBlock>
            <TextBlock TextWrapping="Wrap" d:LayoutOverrides="Width" Text="SOTANK" Foreground="{DynamicResource MetroTextLight}" Margin="15,0,0,0" Style="{DynamicResource MetroHeader2}" FontSize="18.667"/>-->
        </StackPanel>

    </Grid>
</UserControl>
